package com.viewpagerindicator;

import in.srain.cube.image.CubeImageView;
import in.srain.cube.image.ImageLoader;
import in.srain.cube.image.ImageLoaderFactory;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class TabViewImgandTexts extends LinearLayout {

	public int mIndex;
	
	private CubeImageView ivImgMain;
	public TextView tvLeftBottomFlag,tvIndicatorLine;
	private ImageLoader mImageLoader;
	
	
	public TabViewImgandTexts(Context context, AttributeSet attrs) {
		super(context, attrs,R.attr.vpiTabPageIndicatorStyle);
		// TODO Auto-generated constructor stub
		
		mImageLoader = ImageLoaderFactory.create(getContext());
	}
	
	
	@Override
	protected void onFinishInflate() {
		// TODO Auto-generated method stub
		super.onFinishInflate();
		
		ivImgMain = (CubeImageView) findViewById(R.id.ivImgMain);
		tvLeftBottomFlag = (TextView) findViewById(R.id.tvLeftBottomFlag);
		tvIndicatorLine = (TextView) findViewById(R.id.tvIndicatorLine);
	}
	
	public void setTabViewContent(String url,String flag){
		tvLeftBottomFlag.setText(flag);
		if(Integer.parseInt(flag) > 0){
			tvLeftBottomFlag.setBackgroundColor(getResources().getColor(R.color.orange_gl));
		}else{
			tvLeftBottomFlag.setBackgroundColor(getResources().getColor(R.color.grey_B8B8C5));
		}
		Log.i("steve", "" + url + " $ " + flag);
//		Log.i("steve", "setTabViewContent. (" + this.getWidth() + "," + this.getHeight() + ") " + tvLeftBottomFlag.getText());
		ivImgMain.loadImage(mImageLoader, url);
	}
	
    public int getIndex() {
        return mIndex;
    }

}
